//
//  LeftXIBViewController.m
//  We_Travel
//
//  Created by lanou3g on 15/12/10.
//  Copyright © 2015年 lanou3g. All rights reserved.
//

#import "LeftXIBViewController.h"
#import "LoginTableViewController.h"
#import "MyTripTableViewController.h"
#import "ShopProductTableViewController.h"
#import "MyOrderTableViewController.h"
#import "FirstViewController.h"
#import "RESideMenu.h"
#import "WMPageController.h"
#import "HotelTableViewController.h"
#import "NH_DataDownloadTools.h"
#import "AboutViewController.h"
@interface LeftXIBViewController ()


@end

@implementation LeftXIBViewController



- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
/**
 *  点击登录
 *
 */
- (IBAction)loginButton:(UIButton *)sender {
    NSLog(@"%s,%d",__FUNCTION__,__LINE__);
    LoginTableViewController *loginViewController = [[LoginTableViewController alloc]init];
    UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:loginViewController];
    [self.sideMenuViewController setContentViewController:navigationController animated:YES];
    [self.sideMenuViewController hideMenuViewController];
}

/**
 *  我的行程点击事件
 *
 */
- (IBAction)myTripButton:(UIButton *)sender {
    NSLog(@"%s,%d",__FUNCTION__,__LINE__);
    FirstViewController *firstViewController = [[FirstViewController alloc]init];
    UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:firstViewController];
    [self.sideMenuViewController setContentViewController:navigationController animated:YES];
    
    [self.sideMenuViewController hideMenuViewController];

}

/**
 *  购买产品点击事件
 */
- (IBAction)shopProductButton:(id)sender {
    NSLog(@"%s,%d",__FUNCTION__,__LINE__);
    ShopProductTableViewController *shopProductViewController = [[ShopProductTableViewController alloc]init];
    UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:shopProductViewController];
    [self.sideMenuViewController setContentViewController:navigationController animated:YES];
    [self.sideMenuViewController hideMenuViewController];
}

/**
 *  我的订单点击事件
 */
- (IBAction)myOrderButton:(UIButton *)sender {
    NSLog(@"%s,%d",__FUNCTION__,__LINE__);

    NSLog(@"%@~~~~~",self.navigationController);
    WMPageController *pageController = [self p_defaultController];
    pageController.title = @"我的订单";
//    pageController.menuViewStyle = WMMenuViewStyleLine;
//    pageController.titleSizeSelected = 17;
    
    UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:pageController];
    pageController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"leftButtonImage.png"] style:UIBarButtonItemStylePlain target:self action:@selector(presentLeftMenuViewController:)];
    [self.sideMenuViewController setContentViewController:navigationController animated:YES];
    [self.sideMenuViewController hideMenuViewController];


}
- (WMPageController *)p_defaultController {
    NSMutableArray *viewControllers = [[NSMutableArray alloc] init];
    NSMutableArray *titles = [[NSMutableArray alloc] init];

    for (int i = 0; i < 2; i++) {
        Class vcClass;
        NSString *title;
        switch (i % 3) {
            case 0:
                vcClass = [MyOrderTableViewController class];
                title = @"当地游";
                break;
                default:
                vcClass = [HotelTableViewController class];
                title = @"酒店";
                break;
        }
        [viewControllers addObject:vcClass];
        [titles addObject:title];
    }
    WMPageController *pageVC = [[WMPageController alloc] initWithViewControllerClasses:viewControllers andTheirTitles:titles];
    pageVC.pageAnimatable = YES;
    pageVC.menuItemWidth = 85;
    pageVC.postNotification = YES;
    pageVC.bounces = YES;

    return pageVC;
}

/**
 *  反馈&资讯点击事件
 */
- (IBAction)feedbackButton:(UIButton *)sender {
    NSLog(@"%s,%d",__FUNCTION__,__LINE__);
    MyTripTableViewController *myTripViewController = [[MyTripTableViewController alloc]init];
    UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:myTripViewController];
    [self.sideMenuViewController setContentViewController:navigationController animated:YES];
    [self.sideMenuViewController hideMenuViewController];
}

/**
 *  关于
 */
- (IBAction)aboutButton:(UIButton *)sender {
    NSLog(@"%s,%d",__FUNCTION__,__LINE__);
    AboutViewController *aboutViewController = [[AboutViewController alloc]init];
    UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:aboutViewController];
    [self.sideMenuViewController setContentViewController:navigationController animated:YES];
    [self.sideMenuViewController hideMenuViewController];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
